package jodatime;

import java.math.BigDecimal;
import java.math.RoundingMode;

import org.joda.time.DateTime;
import org.joda.time.Days;
import org.joda.time.Hours;
import org.joda.time.Minutes;

public class CalculosDatas {
	public static void main(String[] args) {

		DateTime dataInicial = new DateTime(2012, 12, 1, 12, 0);
		DateTime dataFinal = new DateTime(2012, 12, 28, 12, 30);
		DateTime feriado = new DateTime(2012, 12, 25, 12, 0);

		// calculo de dias
		int dias = Days.daysBetween(dataInicial, dataFinal).getDays();
		System.out.println(dias);

		System.out.println(Hours.hoursBetween(dataInicial, dataFinal)
				.getHours());

		BigDecimal minutos = new BigDecimal(Minutes.minutesBetween(dataInicial,
				dataFinal).getMinutes());
		BigDecimal horas = minutos.divide(new BigDecimal("60"), 2,
				RoundingMode.HALF_UP);
		System.out.println(horas); // 648,50h

	}
}
